/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kx.insta.traitement;

import com.temboo.Library.Twitter.Search.Tweets;
import com.temboo.Library.Twitter.Search.Tweets.TweetsInputSet;
import com.temboo.Library.Twitter.Search.Tweets.TweetsResultSet;
import com.temboo.Library.Twitter.Timelines.HomeTimeline;
import com.temboo.Library.Twitter.Timelines.HomeTimeline.HomeTimelineInputSet;
import com.temboo.Library.Twitter.Timelines.HomeTimeline.HomeTimelineResultSet;
import com.temboo.Library.Twitter.Timelines.Mentions;
import com.temboo.Library.Twitter.Timelines.Mentions.MentionsInputSet;
import com.temboo.Library.Twitter.Timelines.Mentions.MentionsResultSet;
import com.temboo.core.TembooException;
import com.temboo.core.TembooSession;
import java.util.ArrayList;
import org.json.JSONException;

/**
 *
 * @author KX
 */
public class TwitterBean implements SocialNetworkBeanInterface{

    /**
     *
     * @return
     * @throws TembooException
     */
    @Override
    public TembooSession connect() throws TembooException {
        TembooSession session = new TembooSession("smalten", "myFirstApp", "d7c2e7cf553542639bfd278829fb9ae4");
        return session;
    }

        

    @Override
    public void showUnreadLikes(TembooSession session) throws TembooException, JSONException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void showAllLikes() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    public String showUnreadTweets() throws TembooException, JSONException {
            
        TembooSession session = this.connect();
        Tweets tweetsChoreo = new Tweets(session);

        // Get an InputSet object for the choreo
        TweetsInputSet tweetsInputs = tweetsChoreo.newInputSet();

        // Set credential to use for execution
        tweetsInputs.setCredential("KXDevops01");

        // Set inputs
        tweetsInputs.set_Query("1000");

        // Execute Choreo
        TweetsResultSet tweetsResults = tweetsChoreo.execute(tweetsInputs);
        return afficherResultat.showResult(tweetsResults, session);

    }

    @Override
    public Boolean disconnect() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    
    public String showTimeline() throws TembooException, JSONException{
        
            TembooSession session = this.connect();
        
            HomeTimeline homeTimelineChoreo = new HomeTimeline(session);

            // Get an InputSet object for the choreo
            HomeTimelineInputSet homeTimelineInputs = homeTimelineChoreo.newInputSet();

            // Set credential to use for execution
            homeTimelineInputs.setCredential("KXDevops01");

            // Set inputs

            // Execute Choreo
            HomeTimelineResultSet homeTimelineResults = homeTimelineChoreo.execute(homeTimelineInputs);
            return afficherResultat.showResult(homeTimelineResults,session);
    }
    
    public String showMentionOfMe() throws TembooException{
        
                    TembooSession session = this.connect();

            Mentions mentionsChoreo = new Mentions(session);

            // Get an InputSet object for the choreo
            MentionsInputSet mentionsInputs = mentionsChoreo.newInputSet();

            // Set credential to use for execution
            mentionsInputs.setCredential("KXDevops01");

            // Set inputs

            // Execute Choreo
            MentionsResultSet mentionsResults = mentionsChoreo.execute(mentionsInputs);
           return  afficherResultat.showResult(mentionsResults,session);
    }

    @Override
    public void showUnreadMessages(TembooSession session) throws TembooException, JSONException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
}
